package cn.stylefeng.guns.sys.modular.system.service;


import cn.stylefeng.guns.sys.modular.system.entity.MouldBoardMsg;
import cn.stylefeng.guns.sys.modular.system.mapper.MouldBoardMsgMapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
public class MouldBoardMsgService extends ServiceImpl<MouldBoardMsgMapper, MouldBoardMsg> {

    /**
     * 添加内容
     */
    @Transactional(rollbackFor = Exception.class)
    public boolean addMouldBoardMsg(List<MouldBoardMsg> mouldBoardMsgs) {
        Integer mouldId = mouldBoardMsgs.get(0).getMouldId();
        Integer proId = mouldBoardMsgs.get(0).getProId();
        boolean save = false;
        for (MouldBoardMsg msg : mouldBoardMsgs
        ) {
            msg.setMouldId(mouldId);
            msg.setProId(proId);
            save = this.save(msg);
        }
        return save;
    }
}
